home *** CD-ROM | disk | FTP | other *** search
- global gbPC, gFilePath, gPicNo, pcxObj, gSavedList, gFirstSave, captions, downloadPath
-
- on downloadFiles DLType
- dtPath = baSysFolder("desktop")
- if dtPath = EMPTY then
- alert("Error finding desktop folder")
- go("exit")
- end if
- destRoot = dtPath & member("target").text.line[1]
- if gbPC then
- destRoot = destRoot & "\"
- else
- destRoot = destRoot & ":"
- end if
- if not baFolderExists(destRoot) then
- put "create folder"
- res = baCreateFolder(destRoot)
- if res = 0 then
- alert("Error creating folder on desktop")
- go("exit")
- end if
- end if
- repeat with itemName in gSavedList
- SrcPath = downloadPath & itemName
- destPath = destRoot & itemName
- if baFolderExists(SrcPath) then
- saveFolder(SrcPath, destPath)
- next repeat
- end if
- if baFileExists(SrcPath) then
- saveFile(SrcPath, destPath)
- next repeat
- end if
- alert("Error saving file " & SrcPath)
- exit
- go("exit")
- end repeat
- if gFirstSave = 1 then
- Ok = baActivateWindow(baWinHandle())
- if not (captions = VOID) then
- captionSave()
- end if
- alertObj = new(xtra("MUI"))
- alertInitList = [#buttons: #Ok, #default: 1, #title: "Files Saved", #message: "Files have been downloaded to your Desktop.", #movable: 1]
- gSavedList = []
- if objectp(alertObj) then
- result = alert(alertObj, alertInitList)
- end if
- gFirstSave = 1
- end if
- if gFirstSave = 0 then
- Ok = baActivateWindow(baWinHandle())
- if not (captions = VOID) then
- captionSave()
- end if
- alertObj = new(xtra("MUI"))
- alertInitList = [#buttons: #Ok, #default: 1, #title: "Files Saved", #message: "Files have been downloaded to your Desktop.", #movable: 1]
- gSavedList = []
- if objectp(alertObj) then
- result = alert(alertObj, alertInitList)
- end if
- gFirstSave = 1
- end if
- if gFirstSave = -1 then
- Ok = baActivateWindow(baWinHandle())
- alertObj = new(xtra("MUI"))
- alertInitList = [#buttons: #Ok, #default: 1, #title: "Files Saved", #message: "These files have already been downloaded.", #movable: 1]
- gSavedList = []
- if objectp(alertObj) then
- result = alert(alertObj, alertInitList)
- end if
- gFirstSave = 1
- end if
- quitProgram()
- end
-
- on saveFile src, dest
- Ok = baActivateWindow(baWinHandle())
- downloadcheck = 0
- filecheck = baFileExists(dest)
- if filecheck = 0 then
- downloadcheck = 1
- gFirstSave = 1
- res = baCopyFileProgress(src, dest, "IfNotExist", "Saving Files...", "Cancel", 0)
- end if
- if downloadcheck = 0 then
- gFirstSave = -1
- end if
- end
-
- on saveFolder src, dest
- Ok = baActivateWindow(baWinHandle())
- if not baFolderExists(dest) then
- res = baCreateFolder(dest)
- if res = 0 then
- alert("Error creating folder.")
- go("exit")
- end if
- end if
- res = baXCopyProgress(src, dest, "*.*", "IfNotExist", 1, "Saving Files..." & src, "Cancel", 0)
- end
-